﻿using LogisticsAdmin.Common;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogisticsAdmin.BLL;

namespace LogisticsAdmin
{
    public partial class Reg : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnReg_Click(object sender, EventArgs e)
        {
            string account = txtAccount.Text;
            string tel = txtTel.Text;
            string name = txtName.Text;
            string pwd = txtPwd.Text;
            string pwdR = txtPwdR.Text;
            if (string.IsNullOrWhiteSpace(name))
            {
                JSHelper.Alert(this, "姓名不能为空");
                return;
            }
            if (string.IsNullOrWhiteSpace(tel))
            {
                JSHelper.Alert(this, "手机号不能为空");
                return;
            }
            if (string.IsNullOrWhiteSpace(account))
            {
                JSHelper.Alert(this, "账号不能为空");
                return;
            }
            if (string.IsNullOrWhiteSpace(pwd))
            {
                JSHelper.Alert(this, "密码不能为空");
                return;
            }
            if (string.IsNullOrWhiteSpace(pwdR))
            {
                JSHelper.Alert(this, "密码确认不能为空");
                return;
            }
            if (pwd != pwdR)
            {
                JSHelper.Alert(this, "两次密码不一致");
                return;
            }
            UserBLL userBLL = new UserBLL();
            string result = userBLL.Reg(account, tel, pwd, name);
            JSHelper.Alert(this, result);
        }
    }
}